[Feature] Forked Mainnet Simulation Tests#191
Conversation
| EVM.store(target: poolAddr, slot: slotHex(3), value: zero32) | ||
|
|
||
| // --- Slot 4: liquidity = uint128 max --- | ||
| let liquidityAmount: UInt256 = 340282366920938463463374607431768211455 // 2^128 - 1 |
There was a problem hiding this comment.
I'm concerned that we are mocking the uniswap pool in a way that have max liquidity. I understand this is useful to ensure that no matter how much token to swap, the swapped price can always be the targeted price we set.
But in real world, the liquidity is often capped, and we also want to verify the behavior when there isn't enough liquidity.
There was a problem hiding this comment.
Yeah, that is a fair concern.
The intitial scope of the forked simulations was to replicate the existing rebalance style tests, as the team wasn't completely that the behaviour would be matched in a real integration-style test against real oracle integrations & EVM pools.
That being said, I agree that the rigidity leaves room for error. Could be worth exploring another style test as a follow-up with more realistic liquidity ticks, but only asserting properties instead of absolute values (e.g. rebalance happens, health factor improves/hits target, realsistic slippage values don't affect system negatively) rather than exact values. Open to ideas on what that should look like.
| @@ -0,0 +1,294 @@ | |||
| #test_fork(network: "mainnet-fork", height: 143292255) | |||
There was a problem hiding this comment.
What is the difference in the setup between this forked mainnet and rebalance_scenario1_test.cdc?
What is covered in this tests but is not covered in there?
There was a problem hiding this comment.
The main difference is just using the contracts deployed on mainnet instead of the mocked ones (e.g. MockSwapper, MockOracle) in the original rebalance_scenario*.cdc. Otherwise, the tests are identical by design and the expected values are exactly the same.
… feature/forked-simulations
… feature/forked-simulations
… feature/forked-simulations
Co-authored-by: Leo Zhang <zhangchiqing@gmail.com>
Co-authored-by: Leo Zhang <zhangchiqing@gmail.com>
… feature/forked-simulations
There was a problem hiding this comment.
Changes LGTM - Can you approve the PR again @zhangchiqing (It doesn't let me because I opened it)
Description
Feature branch that adds forked rebalance simulations for the real PYUSD0 strategy, mirroring those initially created via mocked bootstrapped tests.
For contributor use:
masterbranchFiles changedin the Github PR explorer